package com.naiterui.ehp.bp.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.IdClass;
import javax.persistence.Table;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.domain.Persistable;

/**
 * <pre>
 * 医生患者关系表
 * </pre>
 *
 * @author wangzehao
 */
@SuppressWarnings("unused")
@Entity
@DynamicInsert
@Table(name = "patient_personal_doctor")
public class PatientPersonDoctor implements java.io.Serializable, Persistable {

    /**
     * 扫码来源，APPS：<code>SCAN_SOUREC_APP</code>
     */
    public static final int SCAN_SOUREC_APP = 0;
    /**
     * 扫码来源，互联网医院PC：<code>SCAN_SOUREC_PC</code>
     */
    public static final int SCAN_SOUREC_PC = 1;
    /**
     * 扫码来源，推荐咨询活动：<code>SCAN_SOUREC_PC</code>
     */
    public static final int SCAN_SOUREC_CONSULT_ACTIVITY = 2;
    /**
     * 关注来源：线上诊室关注
     */
    public static final int SCAN_CODE_SOURCE_CONSULT_ROOM = 3;

    public static final int SCAN_CODE_SOURCE_XSZZ = 5;

    /**
     * 医患关系状态：正常
     */
    public static final int RELATION_FLAG_NORMALITY = 0;

    /**
     * 医患关系状态：删除
     */
    public static final int RELATION_FLAG_DELETE = 1;

    public static final int RELATION_FLAG_DSH = 2;

    private static final long serialVersionUID = -5515499741254601271L;

    /**
     * 医生、患者id主键：<code>personPK</code>
     */
    @EmbeddedId
    private PatientPersonDoctorPK personPK;
    /**
     * 创建时间：<code>createAt</code>
     */
    @Column(name = "create_at")
    private Date createAt;
    /**
     * 患者扫码来源：<code>source</code>
     */
    @Column(name = "source")
    private Integer source;

    /**
     * 医患关系状态 0：正常 ，1：删除
     */
    @Column(name = "relation_flag")
    private Integer relationFlag = PatientPersonDoctor.RELATION_FLAG_NORMALITY;

    /**
     * 操作医患关系时间
     */
    @Column(name = "operate_date")
    private Date operateDate;

    public PatientPersonDoctorPK getPersonPK() {
        return this.personPK;
    }

    public void setPersonPK(PatientPersonDoctorPK personPK) {
        this.personPK = personPK;
    }

    public Date getCreateAt() {
        return this.createAt;
    }

    public void setCreateAt(Date createAt) {
        this.createAt = createAt;
    }

    public Integer getSource() {
        return this.source;
    }

    public void setSource(Integer source) {
        this.source = source;
    }

    public Integer getRelationFlag() {
        return this.relationFlag;
    }

    public void setRelationFlag(Integer relationFlag) {
        this.relationFlag = relationFlag;
    }

    public Date getOperateDate() {
        return operateDate;
    }

    public void setOperateDate(Date operateDate) {
        this.operateDate = operateDate;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

    /**
     * Returns the id of the entity.
     *
     * @return the id. Can be {@literal null}.
     */
    @Override
    public Object getId() {
        return this.personPK;
    }

    /**
     * Returns if the {@code Persistable} is new or was persisted already.
     *
     * @return if {@literal true} the object is new.
     */
    @Override
    public boolean isNew() {
        return this.createAt == null;
    }
}
